﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zombicide.Model;
using Zombicide.Data;

namespace Zombicide.Business
{
    public class HeroService
    {
        List<string> FirstNames = new List<string> { "Emy", "Sandra", "Myke", "Jennifer", "Eric", "John", "Cindy", "Anastasya" };
        List<string> LastNames = new List<string> { "A.", "B.", "C.", "D.", "E.", "F." };
        Random Rnd = new Random();

        public Hero GenerateHero()
        {
            Database database = new Database();
            return database.Heroes.FirstOrDefault(b => b.Name == "Emy"); // TODO : Generation aleatoire - plusieurs tuile random
        }

        public Hero GenerateRandomHero()
        {
            Hero hero = new Hero();
            hero.Name = RandomString(FirstNames) + " " + RandomString(LastNames);
            hero.Hp = Rnd.Next(2, 5);
            hero.PA = Rnd.Next(2, 5);
            return hero;
        }

        private string RandomString(List<string> source)
        {
            var value = Rnd.Next(0, source.Count);
            return source[value];
        }
    }
}
